package com.aaa.behind.service.impl;

import com.aaa.entity.TbHeadNav;
import com.aaa.behind.dao.TbHeadNavMapper;
import com.aaa.behind.service.ITbHeadNavService;
import com.aaa.util.PageInfo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author whj
 * @since 2023-02-01
 */
@Service
public class TbHeadNavServiceImpl extends ServiceImpl<TbHeadNavMapper, TbHeadNav> implements ITbHeadNavService {

    @Autowired
    private TbHeadNavMapper tbHeadNavMapper;

    @Override
    public Page fuzzySearch(PageInfo pageInfo, TbHeadNav tbHeadNav) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        if (tbHeadNav.getHeadName() != null){
            queryWrapper.like("head_name",tbHeadNav.getHeadName());
        }
        if (tbHeadNav.getIsDisable() != null){
            queryWrapper.eq("is_disable",tbHeadNav.getIsDisable());
        }
        return this.page(pageInfo,queryWrapper);
    }

    @Override
    public List<TbHeadNav> navigationSearch() {
        return tbHeadNavMapper.navigationSearch();
    }
}
